﻿using System;
using System.Net;

namespace SDCloudSolution.SDCloud.ServiceAgent
{
    public enum ServiceExceptionType
    {
        Expected,
        Unexpected
    }
    public class ServiceException : Exception
    {
        private const string _message = "Error while executing Service:";
        public ServiceException() : base($"{_message}")
        {
        }

        public ServiceException(string message)
            : base($"{_message} {message}")
        {
        }

        public ServiceException(string message, Exception inner)
            : base($"{_message} {message}", inner)
        {
        }

        public ServiceExceptionType Type { get; set; }
        public string InternalServiceMessage { get; set; }
        public HttpStatusCode InternalServiceStatusCode { get; set; }

        public bool IsExpected => Type == ServiceExceptionType.Expected;
    }
}
